package com.pirestupppai.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.pirestupppai.R;
import com.pirestupppai.base.BaseAdapter;
import com.pirestupppai.base.BaseViewHolder;
import com.pirestupppai.bean.TagItem;
import com.pirestupppai.utils.ImageLoadUtil;

import java.util.List;

/**
 * 搜索标签 列表
 *
 * @author: xiaoluo
 * @date: 2017-04-12 15:15
 */
public class SearchTagAdapter extends BaseAdapter<TagItem> {
    public static final int JUMP_TYPE_LIST = 110;
    public static final int JUMP_TYPE_RETURN = 120;

    private Context mContext;
    private List<TagItem> mList;



    public SearchTagAdapter(Context context, List<TagItem> list) {
        super(list);
        this.mContext = context;
        this.mList = list;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_search_tag;
    }

    @Override
    protected void bindData(BaseViewHolder holder, int position) {
        ImageView labelImage = holder.getView(R.id.search_tag_iv);
        TextView labelTitle = holder.getView(R.id.search_tag_title);
        TextView labelCount = holder.getView(R.id.search_tag_count);


        labelTitle.setText(mList.get(position).getText());
        labelCount.setText("已有" + mList.get(position).getUse_count() + "张图片");
        if (mList.get(position).getCover_media() != null) {
            ImageLoadUtil.getInstance().loadImage(mList.get(position).getCover_media().getPathname(),
                    labelImage, ImageLoadUtil.LoadOption.LOAD_MEDIUM);
        }
    }
}
